package com.mh.www.mh_frame.view.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.mh.www.mh_frame.R;
import com.mh.www.mh_frame.model.bean.MeetingSummaryBean;
import com.mh.www.mh_frame.util.DateUtil;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class MeetingSummaryAdapter extends RecyclerView.Adapter<MeetingSummaryAdapter.MeetingHolder> {


    private Context mContext;
    private List<MeetingSummaryBean.DataBean> mList;

    public MeetingSummaryAdapter(Context context, List<MeetingSummaryBean.DataBean> list) {
        this.mContext = context;
        this.mList = list;

    }

    @Override
    public MeetingHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View itemView = View.inflate(mContext, R.layout.item_meeting_summary, null);
        return new MeetingHolder(itemView);
    }

    @Override
    public void onBindViewHolder(MeetingHolder holder, int position) {
        holder.tvItemTitle.setText(mList.get(position).getTITLE());
        holder.tvDate.setText(DateUtil.formatDateTime(mList.get(position).getCREATEDATE(),DateUtil.DF_YYYY_MM_DD));
    }

    @Override
    public int getItemCount() {
        return mList.size();
    }

    class MeetingHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.tv_item_title)
        TextView tvItemTitle;
        @BindView(R.id.tv_date)
        TextView tvDate;
        public MeetingHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }
}
